﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Text;
using T.FAS.Runtime.Metadata.Entity.Page;
using T.ServiceComponent.DAC.Service;
using T.ServiceComponent.Database.Service;

namespace T.FAS.Runtime.Page.Dao
{
    public class PageMetaDataDao : DaoService<PageMetaData>
    {
        public PageMetaDataDao() :
           base()
        {
            DBName = "TFAS";
        }

        public override string TableName => "FAS_PageMetaData";
        public override string IDColumnName => "ID";
        public override List<string> ExceptColumnName => new List<string> { "MetaDataID", "MetaDataCode", "MetaDataName", "MetaData", "CurrentVersion", "CompatibleMinVersion", "EngineVersion", "Header", "PageParameters", "PageOutParameters", "ExtProperties", "LocalVariables", "ViewModels", "PCUIDom", "MobileUIDom", "ReactiveUIDom", "Events", "Methods", "CtrlMethods", "CtrlEvents", "PageEntry", "ProjectBranchID", "PageRefInstances", "PageRefSchemas", "MetaDependency", "MetaDependencys", "TranslatedTerms", "SubSystemCode", "ConditionStyles", "MicroflowJSON" };
        public bool CheckUnique(string ID, string code)
        {
            string filter = "Code='" + code + "'";
            if (!string.IsNullOrEmpty(ID))
            {
                filter += "and ID != '" + ID + "'";
            }
            List<object> objects = base.GetObjectsByFilter(filter);
            if (objects == null)
            {
                return false;
            }
            return true;
        }
    }
}
